<template>
  <div class="b-cate-add">
    <el-row>
      <el-col :span="24">
        <h3>添加分类</h3>
      </el-col>
    </el-row>
    <hr />
    <el-form :model="cateObj" :rules="rules" ref="cateObj" class="cate-form">
      <el-form-item label="分类名称：" prop="title">
        <el-input v-model="cateObj.title" size="small"></el-input>
      </el-form-item>
      <el-form-item label="排序：" prop="sort">
        <el-input v-model="cateObj.sort" size="small"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm('cateObj')"
          >提交</el-button
        >
        <el-button @click="$emit('close')">关闭</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  name: "BCateAdd",
  data() {
    return {
      cateObj: { title: "", sort: "" },
      rules: {
        title: [
          { required: true, message: "请输入分类名称", trigger: "blur" },
          { min: 2, message: "分类名称最少两个字", trigger: "blur" }
        ],
        sort: [{ required: true, message: "请输入活动名称", trigger: "blur" }]
      }
    };
  }
};
</script>
<style scoped lang="scss">
.b-cate-add {
  width: 360px;
  height: 260px;
  position: fixed;
  z-index: 10001;
  top: 50%;
  left: 50%;
  margin-left: -180px;
  margin-top: -130px;
  background: #fff;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 12px 2px rgba(255, 255, 255, 0.3);
  .el-form {
    margin-top: 30px;
  }
  h3 {
    margin: 2px auto;
  }
  ::v-deep .el-form-item__label {
    padding-right: 0;
    width: 80px;
  }
  .el-input {
    width: 76%;
  }
  ::v-deep .el-form-item__error {
    left: 82px;
  }
}
</style>
